package com.glory.wxelectricitypda.adapter;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.wxelectricitypda.R;
import com.glory.wxelectricitypda.activity.MaterialPrePareActivity;
import com.glory.wxelectricitypda.bean.MlotAppointmentListEntity;

import java.util.List;


public class MatNumListAdapter extends BaseQuickAdapter<MlotAppointmentListEntity.MlotAppointmentEntity, BaseViewHolder> {

    private MaterialPrePareActivity.OnItemMatClick mCallback;
    public MatNumListAdapter(@Nullable List<MlotAppointmentListEntity.MlotAppointmentEntity> data, MaterialPrePareActivity.OnItemMatClick click) {
        super(R.layout.adapter_mat_num_list, data);
        this.mCallback = click;
    }

    @Override
    protected void convert(BaseViewHolder helper, MlotAppointmentListEntity.MlotAppointmentEntity item) {
        helper.setText(R.id.tvNum,item.getMaId());
        helper.setText(R.id.tvmLotid,item.getMaterialName());
        helper.setText(R.id.tvMlotF,item.getMaterialType());
        helper.setText(R.id.maType,item.getMaType());
        helper.setText(R.id.ltReason,item.getLtReason());
        helper.setText(R.id.tvQTY,String.valueOf(item.getMlotMainQty()));
        helper.getView(R.id.llMain).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mCallback != null){
                    mCallback.setOnItemMatClickListener(helper.getAdapterPosition());
                }
            }
        });

    }
}
